package com.codefarm.phone.mtsh.doctor.activity;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;

import com.codefarm.phone.mtsh.doctor.Constant;
import com.codefarm.phone.mtsh.doctor.util.UserManager;
import com.codefarm.phone.mtsh.doctor.R;
import com.tencent.bugly.crashreport.CrashReport;

/**
 * 1.秒钟渐现动画效果
 */
public class SplashActivity extends CommonBaseActivity {
	/* {author=梁研, see=启动界面} */
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		this.setContentView(R.layout.activity_splash);
		
		CrashReport.initCrashReport(getApplicationContext(), Constant.TENCENT_BUTLY.APP_ID, true);
		
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				boolean firstFlag = getSharedPreferences(Constant.KEY.FIRST_FLAG, Context.MODE_PRIVATE).getBoolean(Constant.KEY.FIRST_FLAG, false);
				if(!firstFlag){
					getSharedPreferences(Constant.KEY.FIRST_FLAG, Context.MODE_PRIVATE).edit().putBoolean(Constant.KEY.FIRST_FLAG, true).commit();
					toIntroduct();
				}else if(UserManager.ifLogin(SplashActivity.this)){
					//TODO:已登陆时跳转
					//S.AppService.startAcvitity(SplashActivity.this, null);
				}else{
					//TODO:未登陆时跳转
					//S.AppService.startAcvitity(SplashActivity.this, null);
					//toIntroduct();
				}
				SplashActivity.this.finish();
			}
		}, 1600);
	}

	// 跳转到引导页
	private void toIntroduct() {
		//TODO:引导页
	}
	
}